<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>邀请记录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="../default/css/mui.min.css">
    <link rel="stylesheet" type="text/css" href="../default/css/index.css" />
    <style type="text/css">
        .mui-content{
            background: #fff;
            min-height: 100%;
        }
        .mui-table-view:before{
            height: 0;
        }
        .mui-table-view:after{
            background-color: #F5F6F7;
        }
        .mui-table-view-cell:after{
            background-color: #F5F6F7;
        }
        /*.mui-table-view-cell{
            padding: 20px 10px;
        }*/
        .nocase-box{
            display: none;
        }

    </style>
</head>
<body>

<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 class="mui-title">邀请记录</h1>
</header>

<div class="mui-content">
    <div class="mui-row">
        <div class="mui-col-xs-4">
            <div class="mui-content-padded mui-text-center">
                <h5>累计邀请</h5>
                <h4 style="margin: 1.625rem auto;"> <b id="friendnum">-</b>人</h4>
            </div>
        </div>
        <div class="mui-col-xs-4">
            <div class="mui-content-padded mui-text-center">
                <h5>直推人数</h5>
                <h4 style="margin: 1.625rem auto;"> <b id="allNumber">-</b>人</h4>
            </div>
        </div>
        <div class="mui-col-xs-4">
            <div class="mui-content-padded mui-text-center">
                <h5>总业绩</h5>
                <h4 style="margin: 1.625rem auto;"> <b id="all">-</b>元</h4>
            </div>
        </div>
    </div>

    <div class="top-shadow"></div>
    <ul class="mui-table-view">
        <li class="mui-table-view-cell mui-collapse">
            <a class="mui-navigate-right" href="#">一级</a>
            <div class="mui-collapse-content aclass-nav">
                <p>暂无数据</p>
            </div>
        </li>
        <li class="mui-table-view-cell mui-collapse">
            <a class="mui-navigate-right" href="#">二级</a>
            <div class="mui-collapse-content bclass-nav">
                <p>暂无数据</p>
            </div>
        </li>
        <!--<li class="mui-table-view-cell mui-collapse">-->
            <!--<a class="mui-navigate-right" href="#">三级</a>-->
            <!--<div class="mui-collapse-content cclass-nav">-->
                <!--<p>暂无数据</p>-->
            <!--</div>-->
        <!--</li>-->
    </ul>
    <div class="nocase-box">
        <div class="mui-table">
            <div class="mui-col-xs-12 mui-col-sm-12 mui-text-center" >
                <img src="https://srhub.oss-cn-hangzhou.aliyuncs.com/zq-news/images/nocase.png" alt="">
            </div>
            <div class="mui-col-xs-12 mui-col-sm-12 mui-inline mui-text-center">
                <h4>暂无记录</h4>
                <h5 style="margin-top: 20px;">你为进行任何操纵</h5>
                <button type="button" class="mui-btn mui-btn-warning cash-withdrawal-btn">邀请好友</button>
            </div>
        </div>
    </div>

</div>

<script src="../default/js/jquery-2.14.js" type="text/javascript" charset="utf-8"></script>
<script src="../default/js/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../default/js/cookie.js"></script>
<script src="../default/js/code.js" type="text/javascript" charset="utf-8"></script>
<script src="../default/js/index.js" type="text/javascript" charset="utf-8"></script>
<script src="../default/js/public.js"></script>


<script>
    mui.init({
        swipeBack: true //启用右滑关闭功能
    });
    mui.showLoading("正在加载..","div");
    // ajax地址
    $(function () {
        querySubordinate();
        queryUserPerformance();
        numberOfProductsSix();
        numberOfProductsFour();
    })
    function querySubordinate() {
        // 查出用户的所有下级用户
        $.ajax({
            url:website+'/OrderController/numberOfProductsTwo',
            type:'post',
            data:{userId:userId},
            success:function (data) {
                console.log(data);
                var html='';
                var html2='';
                var html3='';
                data.data.forEach(function (value) {
                    // if(value.subordinate == '一级'){
                        html+='<div class="mui-table">\n' +
                            '                            <div class="mui-col-xs-3 mui-col-sm-3 mui-inline mui-text-center" >\n' +
                            '                                <img src="https://srhub.oss-cn-hangzhou.aliyuncs.com/zq-news/icon/user-logo.png" alt="" width="50" class="border-radius5">\n' +
                            '                            </div>\n' +
                            '                            <div class="mui-col-xs-9 mui-col-sm-9 mui-inline">\n' +
                            '                                <h5>'+value.user_name+'</h5>\n' +
                            '                                <h5>'+value.time+'</h5>\n' +
                            '                            </div>\n' +
                            '                        </div>'
                    // }
                    // else if(value.subordinate == '二级'){
                    //     html2+='<div class="mui-table">\n' +
                    //         '                            <div class="mui-col-xs-3 mui-col-sm-3 mui-inline mui-text-center" >\n' +
                    //         '                                <img src="https://srhub.oss-cn-hangzhou.aliyuncs.com/zq-news/icon/user-logo.png" alt="" width="50" class="border-radius5">\n' +
                    //         '                            </div>\n' +
                    //         '                            <div class="mui-col-xs-9 mui-col-sm-9 mui-inline">\n' +
                    //         '                                <h5>'+value.userName+'</h5>\n' +
                    //         '                                <h5>'+value.time+'</h5>\n' +
                    //         '                            </div>\n' +
                    //         '                        </div>'
                    // }else if(value.subordinate == '三级'){
                    //     html3+='<div class="mui-table">\n' +
                    //         '                            <div class="mui-col-xs-3 mui-col-sm-3 mui-inline mui-text-center" >\n' +
                    //         '                                <img src="https://srhub.oss-cn-hangzhou.aliyuncs.com/zq-news/icon/user-logo.png" alt="" width="50" class="border-radius5">\n' +
                    //         '                            </div>\n' +
                    //         '                            <div class="mui-col-xs-9 mui-col-sm-9 mui-inline">\n' +
                    //         '                                <h5>'+value.userName+'</h5>\n' +
                    //         '                                <h5>'+value.time+'</h5>\n' +
                    //         '                            </div>\n' +
                    //         '                        </div>'
                    // }


                });
                $(".aclass-nav").html(html);
                $(".cclass-nav").html(html3);

                mui.hideLoading();
            },
            error:function () {
                mui.showLoading("未知错误..","div");
            }
        });
    };

    var friendnum = 0;
    function numberOfProductsFour() {
        // 查出用户的所有下级用户
        $.ajax({
            url:website+'/OrderController/numberOfProductsFour',
            type:'post',
            data:{userId:userId},
            success:function (data) {
                var html2='';
                data.data.forEach(function (value) {
                    html2+='<div class="mui-table">\n' +
                        '                            <div class="mui-col-xs-3 mui-col-sm-3 mui-inline mui-text-center" >\n' +
                        '                                <img src="https://srhub.oss-cn-hangzhou.aliyuncs.com/zq-news/icon/user-logo.png" alt="" width="50" class="border-radius5">\n' +
                        '                            </div>\n' +
                        '                            <div class="mui-col-xs-9 mui-col-sm-9 mui-inline">\n' +
                        '                                <h5>'+value.user_name+'</h5>\n' +
                        '                                <h5>'+value.time+'</h5>\n' +
                        '                            </div>\n' +
                        '                        </div>'
                });
                $(".bclass-nav").html(html2);
                console.log(friendnum);
                $("#friendnum").html(friendnum + data.data.length);
                mui.hideLoading();
            },
            error:function () {
                mui.showLoading("未知错误..","div");
            }
        });
    }

    function numberOfProductsSix() {
        // 查出用户的所有下级用户
        $.ajax({
            url: website + '/OrderController/numberOfProductsSix',
            type: 'post',
            data: {userId: userId},
            async: false,
            success: function (data) {
                // $("#friendnum").html(data.data.count);
                friendnum = data.data.number;
                $("#allNumber").html(data.data.number);
            }, error: function () {

            }
        });
    };

    function queryUserPerformance() {
        // 总业绩业绩
        $.ajax({
            url: website + '/OrderController/queryUserPerformance',
            type: 'post',
            data: {userId: userId},
            success: function (data) {
                $("#all").html(data.data.achievement);
                // $("#friendnum").html(data.data);
            }, error: function () {

            }
        });
    };


    //加法 
    function accAdd(arg1,arg2){
        var r1,r2,m;
        try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
        try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
        m=Math.pow(10,Math.max(r1,r2))
        return (arg1*m+arg2*m)/m
    }



</script>
</body>
</html>
